package cn.imnaer.service.rest.resquest.model;

import java.util.ArrayList;
import java.util.List;

import cn.imnaer.service.persistence.model.ContributionImageItem;
import cn.imnaer.service.persistence.model.ScenicContribution;

public class ScenicContributeParams {

	private String userId;
	private String scenicId;
	private String text;
	private int score;
	private List<String> images = new ArrayList<>();
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getScenicId() {
		return scenicId;
	}
	public void setScenicId(String scenicId) {
		this.scenicId = scenicId;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	public List<String> getImages() {
		return images;
	}
	public void setImages(List<String> images) {
		this.images = images;
	}
	public ScenicContribution toScenicContribution() {
		ScenicContribution scenicContribution = new ScenicContribution();
		List<ContributionImageItem> imageInfoList=new ArrayList<>();
		for (int i=0;i<images.size();i++) {
			ContributionImageItem imageInfo = new ContributionImageItem();
			if(i==0){
			imageInfo.setText(text);
			}
			imageInfo.setImage(images.get(i));			
			imageInfoList.add(imageInfo);
		}
		scenicContribution.setScenicId(scenicId);
		scenicContribution.setUserId(userId);
		scenicContribution.setItems(imageInfoList);
		scenicContribution.setScore(score);
		return scenicContribution;

	}
	

}
